home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 March: Reference Library / Dev.CD Mar 96 RL / Dev.CD Mar 96 RL.toast / Technical Documentation / develop / develop Issue 25 / develop Issue 25 code / C++ exceptions in C / UDebugging.cp < prev    next >
Encoding:
Text File  |  1995-04-20  |  1.5 KB  |  63 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    UDebugging.cp                    ©1994 Metrowerks Inc. All rights reserved.
  3. // ===========================================================================
  4. //
  5. //    Utility functions for debugging
  6.  
  7. #ifdef PowerPlant_PCH
  8. #include PowerPlant_PCH
  9. #endif
  10.  
  11. #include <UDebugging.h>
  12.  
  13. #ifndef __DIALOGS__
  14. #include <Dialogs.h>
  15. #endif
  16.  
  17.     // Global variables for specifying the action to take for
  18.     // a Throw and a Signal
  19.  
  20. EDebugAction    gDebugThrow = debugAction_Nothing;
  21. EDebugAction    gDebugSignal = debugAction_Nothing;
  22.  
  23.  
  24. const    short    ALRT_ThrowAt    = 251;
  25. const    short    ALRT_SignalAt    = 252;
  26.  
  27.  
  28. // ---------------------------------------------------------------------------
  29. //        • AlertThrowAt
  30. // ---------------------------------------------------------------------------
  31. //    Display an Alert Box when a Throw occurs
  32.  
  33. void
  34. UDebugging::AlertThrowAt(
  35.     unsigned char    *inError,
  36.     unsigned char    *inFile,
  37.     long            inLine)
  38. {
  39.     Str15    lineStr;
  40.     ::NumToString(inLine, lineStr);
  41.     
  42.     ::ParamText(inError, inFile, lineStr, "\p");
  43.     ::StopAlert(ALRT_ThrowAt, nil);
  44. }
  45.  
  46.  
  47. // ---------------------------------------------------------------------------
  48. //        • AlertSignalAt
  49. // ---------------------------------------------------------------------------
  50. //    Display an Alert Box when a Signal occurs
  51.  
  52. void
  53. UDebugging::AlertSignalAt(
  54.     unsigned char    *inTestStr,
  55.     unsigned char    *inFile,
  56.     long            inLine)
  57. {
  58.     Str15    lineStr;
  59.     ::NumToString(inLine, lineStr);
  60.     
  61.     ::ParamText(inTestStr, inFile, lineStr, "\p");
  62.     ::StopAlert(ALRT_SignalAt, nil);
  63. }